package ar.com.fiuba.ElectronicCircuitAnalyst.application.api;

import ar.com.fiuba.ElectronicCircuitAnalyst.domain.api.Circuit;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.AlreadyExistingCircuitElementException;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.CircuitElementNotFoundException;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.InvalidCircuitElementException;

/**
 * Interface for a service that provides operations over circuits. It works
 * basically as a CRUD for circuits.
 * 
 */
public interface CircuitService {

	/**
	 * Method to make a circuit with the specifications given.
	 * 
	 * @param data
	 *            the DTO holding the information to create the Circuit. The
	 *            name of the circuit to be modified is taken from the DTO too.
	 * @return the circuit with the specified parameters.
	 * @throws InvalidCircuitElementException
	 *             if there's any inconcistency in the parameters.
	 * @throws AlreadyExistingCircuitElementException
	 *             if there's circuit with the same name exists.
	 */
	public Circuit makeCircuit(CircuitDto data) throws InvalidCircuitElementException,
			AlreadyExistingCircuitElementException;

	/**
	 * Method to modify a circuit.
	 * 
	 * @param data
	 *            the DTO holding the information to modify the Circuit.
	 * @return the circuit with the modifications specified.
	 * @throws InvalidCircuitElementException
	 *             if there's any inconcistency in the parameters.
	 * @throws CircuitElementNotFoundException
	 *             if there's no such circuit with the provided name.
	 */
	public Circuit modifyCircuit(CircuitDto data) throws InvalidCircuitElementException,
			CircuitElementNotFoundException;

	/**
	 * Method to retrieve a circuit by name.
	 * 
	 * @param name
	 *            name of the desired circuit.
	 * @return the circuit which matches the given name.
	 * @throws CircuitElementNotFoundException
	 *             if there's no circuit with such name.
	 */
	public Circuit getCircuit(String name) throws CircuitElementNotFoundException;

	/**
	 * Method to remove a circuit.
	 * 
	 * @param name
	 *            name of the undesired circuit.
	 * @throws CircuitElementNotFoundException
	 *             if there's no such circuit with the name.
	 */
	public void removeCircuit(String name) throws CircuitElementNotFoundException;
}
